#include "app_pool.h"

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
void fun(void *args)
{
    int value = *(int *)args;
    free(args);

    pthread_mutex_lock(&mutex);
    printf("线程 %d\n", value);
    pthread_mutex_unlock(&mutex);
}

int main(int argc, char const *argv[])
{
    app_pool_init(10);

    for (size_t i = 0; i < 10; i++)
    {
        int *p = malloc(sizeof(int));
        *p = i;
        app_pool_add_task(fun, p);
    }

    sleep(100000);
    return 0;
}
